#ifndef LOGIN_H
#define LOGIN_H

#include <QWidget>
#include<QTcpSocket>
#include"protocol.h"

namespace Ui {
class login;
}

class login : public QWidget
{
    Q_OBJECT

public:
    explicit login(QWidget *parent = nullptr);
    ~login();
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void mouseReleaseEvent(QMouseEvent *event);
    virtual void mouseMoveEvent(QMouseEvent *event);
    static login &getInstance();
    QTcpSocket &getTcpSocket();
    QString getStrName() const;
    void setStrName(const QString &strName);
    QString getStrCurPath() const;
    void setStrCurPath(const QString &strCurPath);
    QString getStrRootPath() const;
    void setStrRootPath(const QString &strRootPath);

public  slots:
     void showConncet();
     void receiveMsg();
private slots:   
    void on_toolButton_clicked();

    void on_toolButton_2_clicked();

    void on_bnt_login_clicked();

    void on_btn_register_clicked();

private:
    Ui::login *ui;
    QString m_strIP;
    quint16 m_usPort;
    QTcpSocket m_tcpSocket;

    QString m_strName;
    QString m_strRootPath;
    QString m_strCurPath;

    bool m_isPressed =false;
    QRect m_titlerect;
    QPoint m_wnd;
    QPoint press;
    bool isMaximized;
};

#endif // LOGIN_H
